define(['jquery', 'layui'],function($, layui) {  //鑾峰彇鏂囦欢璺緞
	var website = 'http://192.168.1.179:8800/budget';
	return {
		interface: {
			"typeInfo": website + "/lookvalue/queryLookTypeInfo",  //璐圭敤浠ｇ爜tree
			"valueInfo": website + "/lookvalue/queryLookValueInfo", //璐圭敤浠ｇ爜table
			"setValueInfo": website + "/lookvalue/saveOrUpdateValue", //淇敼璐圭敤浠ｇ爜table

			"categoryModelList": website + "/categorymodel/getCategoryModelList",  //鍒嗙被/妯″潡缁存姢tree
			"updateValue":  website + "/categorymodel/saveOrUpdateValue",  //鍒嗙被/妯″潡缁存姢鏂板鎴栬�呬慨鏀�
			"categoryModelList": website + "/categorymodel/getCategoryModelList",  //分类/模块维护tree
			"updateValue":  website + "/categorymodel/saveOrUpdateValue",  //分类/模块维护tree新增或者修改
			"detailCategoryMode": website + "/categorymodel/queryDetailCategoryModel", //分类/模块维护table
			"queryDetailYCA": website + "/categorymodel/queryDetailYCA",  //分类/模块维护itemTable

			"ycaTree": website + "/yca/queryTreeList",//运材安树展示
			"ycaTableInfo": website + "/yca/queryYCAInfo",//运材安表格展示
			"ycaTableEdit": website + "/yca/saveOrUpdateValue",//运材安表格修改

			"projectTree": website + "/project/getProjectTreeList",//项目页树展示
			"projectTreeEdit": website + "/project/saveOrUpdateProject",//项目页树节点增删改
			"projectTableParent": website + "/project/getSumList",//项目页表格父类展示
			"projectTableChild": website + "/feetotal/queryFeeTotalInfo",//项目页表格子类展示
			"projectInfo":  website + "/project/getProjectInfo", //新建项目的项目信息

			"projectItemInfo": website + "/unitproject/getBitProjectItemInfo", //分布分项-子目展示
			"deleteProjectItem": website + "/unitproject/deleteBitProjectItem", //分布分项-子目删除
			"projectInsertItem": website + "/unitproject/insertItem", //分布分项-新增子目

			"insertProjectDetail": website + "/unitproject/insertDetail", //分布分项-运材安新增
			"projectDetailInfo": website + "/unitproject/getBitProjectDetailInfo", //分布分项-运材安展示
			"deletProjectDetail": website + "/unitproject/deleteBitProjectDetail", //分布分项-运材安删除

			"ycaTotalInfo": website + "/ycatotal/queryYCATotalInfo", //运材安汇总展示

			"feeTotalInfo": website + "/feetotal/queryFeeTotalInfo" //费用汇总展示

		},
		tableRender: {
			/*
				分部分项;
				每一个对象都缺少一个键值对{isRequired:true}，默认为true，如果为false,则需要添加
			 */
			unitproject: [
				{name:'checkbox',text:''},
				{name:'code',text:'编码'},
				{name:'matesRate',text:'材料换算系数',filter:'decimal'},
				{name:'transRate',text:'运输换算系数',filter:'decimal'},
				{name:'instsRate',text:'安装费换算系数',filter:'decimal'},
				{name:'Type',text:'类别'},
				{name:'name',text:'名称'},
				{name:'projectProp',text:'项目特征'},
				{name:'unit',text:'单位'},
				{name:'dtgcl',text:'工程量',filter:'decimal'},
				{name:'singlePrice',text:'不含税单价',filter:'decimal'},
				{name:'price',text:'含税单价',filter:'decimal'},
				{name:'taxSinglePrice',text:'不含税合价',filter:'decimal'},
				{name:'taxSingleSumPrice',text:'含税合价',filter:'decimal'},
				{name:'singleSumPrice',text:'综合单价（元）',filter:'decimal'},
				{name:'singleMates',text:'材料单价（元）',filter:'decimal'},
				{name:'singleTrans',text:'运输单价（元）',filter:'decimal'},
				{name:'singleInsts',text:'安装单价（元）',filter:'decimal'},
				{name:'sumPrice',text:'综合合价（元）',filter:'decimal'},
				{name:'sumMetes',text:'材料合价（元）',filter:'decimal'},
				{name:'sumTrans',text:'运输合价（元）',filter:'decimal'},
				{name:'sumInsts',text:'安装合价（元）',filter:'decimal'},
				{name:'remark',text:'备注',isRequired:false}
			]
		},
		//表格的动态隐藏显示列
  		_toggleVisInit: function(columnObj,tableId,callback){
		    var begin = '<div class="caozuo-box" id="caozuo-box"><form class="layui-form"><div class="caozuo-vis" id="caozuo-vis"><h3 class="title">选择隐藏的列</h3><div class="content"><ul>';
		    var columns = columnObj,
		    content = '';
		    $.each(columns, function(index, el) {
		    	for(var i=0;i<el.length;i++){
				    if(el[i].field && el[i].title.trim()!=""){
				    	var d = '<li><input data-field="'+el[i].field+'" type="checkbox" name="'+el[i].field+'" title="'+el[i].title+'" lay-skin="primary" /></li>';
						content+=d;					
				    }
			    }	
		    });		    
		    var end = '</ul></div><div class="footer"><button type="button" class="ant-btn ant-btn-ghost caozuo-visbtn" ><span>确 定</span></button>'
		    +	'<button type="button" class="ant-btn caozuo-cancel" ><span>取 消</span></button></div></div></form></div>'
		    var html = begin+content+end;
		    var submain_table = $(tableId).next(".layui-table-view");
		    submain_table.append(html);
		    callback && callback();
		   	$(document).off('click', '.isShowHide').on('click', '.isShowHide', function(e){
              	isshow_caozuo('show',e.target);
            })
        	$('.caozuo-visbtn').on('click', function (e) {
		      	e.preventDefault();
		      	var inputArr = $(this).parents('.caozuo-vis').find("input[type='checkbox']");
		      	for(var i=0; i< inputArr.length; i++){
		       		var ischecked = inputArr.eq(i).prop('checked'),
		       			field = $(inputArr[i]).data('field');
		       		if(ischecked){		       			
		       			submain_table.find('td[data-field="'+field+'"],th[data-field="'+field+'"]').hide(0);
		       		}else{
		       			submain_table.find('td[data-field="'+field+'"],th[data-field="'+field+'"]').show(0);
		       		}
		      	}
		      	isshow_caozuo('hide',e.target);
		    });
		    $('.caozuo-cancel').on('click', function (e) {
		    	isshow_caozuo('hide',e.target);
		    })
		   	function isshow_caozuo(isshow,elem){//操作显示隐藏table列
				if(isshow == "show"){
					submain_table = $(elem).parent(".cf").next(".layui-table").next(".layui-table-view");
					submain_table.find(".caozuo-vis").css('display','block').animate({
						right: '0'
					}, 300);
				}else{
					$(elem).parents(".caozuo-vis").animate({
						right: "-200px"
					}, 300, function(){
						$(this).css('display','none');
					});
				}
				
			}
  		},
		_pathOperate: function(callback){
			var htpsIndex =  $('.requirePath')[0].src.indexOf('budget_system'),
			dir = $('.requirePath')[0].src.substr(0,htpsIndex);
			layui.config({dir: dir+'budget_system/src/plugins/layui/'});
		},
		_pageJumpOperate: function(link){
			require(['./modules/'+ link], function (operatefn) {
               	operatefn && operatefn();
            });		
		}
	}
	
})